package com.dragon.pear.modules.admin.web.controller;

import com.chris.dev.base.libs.v1.http.params.NoneParam;
import com.chris.dev.base.libs.v1.http.protocols.HttpHeader;
import com.dragon.common.base.contexts.CommonRequestContextHolder;
import com.dragon.pear.modules.admin.service.def.AdminService;
import com.dragon.pear.modules.admin.web.api.AdminApi;
import com.dragon.pear.modules.admin.web.model.result.UserBaseInfoResult;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Chris Chan
 * Create On 2025/8/26 下午7:10
 * Use for: 管理 接口实现
 * Explain:
 */
@RestController
@RequestMapping("admin")
public class AdminController implements AdminApi {
    @Autowired
    private AdminService adminService;

    @Override
    public UserBaseInfoResult getUserBaseInfo(@RequestBody NoneParam param) {
        HttpHeader header = CommonRequestContextHolder.getHeader();
        System.out.println("header: \n" + new Gson().toJson(header));
        System.out.println("lng: " + header.getLng() + ", lat: " + header.getLat());
        return UserBaseInfoResult.of(1L, 1L, "孤勇者", "admin");
    }
}
